import type { Response_Dto } from "@/Dto/Response/Api_Result"
import request from "@/utils/request"

/**
 * 获取字典类别列表
 * @param obj 
 * @returns 
 */
export const Get_Dic_Types=(obj:{page:number,limit:number,key:string}):Promise<Response_Dto>=>{

    return request({
        url:'api/dictionary/Get_AllDic_Type',
        method:'get',
        params:obj
    })
}
/**
 * 删除字典类别
 * @param obj 
 * @returns 
 */
export const Delete_Dic_Type=(obj:{ids:string[]}):Promise<Response_Dto>=>{

    return request({
        url:'api/dictionary/Delete_Dictionary_Type',
        method:'post',
        data:obj
    })
}
/**
 * 删除字典
 * @param obj 
 * @returns 
 */
export const Delete_Dic=(obj:{ids:string[]}):Promise<Response_Dto>=>{
    return request({
        url:'api/dictionary/Delete_Dictionarys',
        method:'post',
        data:obj
    })
}
/**
 * 获取单个字典类别
 * @param obj 
 * @returns 
 */
export const Get_Singlr_Dic_Type=(obj:{id:string}):Promise<Response_Dto>=>{
    return request({
        url:'api/dictionary/Get_Single_Dic',
        method:'get',
        params:obj
    })
}

/**
 * 新增字典
 * @param obj 
 * @returns 
 */
export const Add_Dic=(obj:{name:string;value:string;type:string,explain:string}):Promise<Response_Dto>=>{
    return request({
        url:'api/dictionary/Add_Dic',
        method:'post',
        data:obj
    })
}
/**
 * 新增字典类别
 * @param obj 
 * @returns 
 */
export const Add_Dic_Type=(obj:{name:string;value:string;gjkey:string,explain:string}):Promise<Response_Dto>=>{
    return request({
        url:'api/dictionary/Add_Dic_Type',
        method:'post',
        data:obj
    })
}

/**
 * 修改字典类别
 * @param obj 
 * @returns 
 */
export const Up_Dic=(obj:{id:string,name:string,key:string,value:string}):Promise<Response_Dto>=>{
    return request({
        url:'api/dictionary/Up_Dic',
        method:'post',
        data:obj
    })
}
/**
 * 编辑修改字典信息
 * @param obj 
 * @returns 
 */
export const Edit_Dic=(obj:{id:string,name:string,explain:string,value:string}):Promise<Response_Dto>=>{
    return request({
        url:'api/dictionary/Edit_Dic',
        method:'post',
        data:obj
    })
}


/**
 * 获取字典 根绝类别key 
 * @param obj  ids:[key集合]
 * @returns 
 */
export const get_Dictionary_ByKey = (obj: { keys: string[] }):
    Promise<Response_Dto> => {
    return request({
        url: "api/dictionary/get_Dictionary_ByKey",
        method: "post",
        data: obj
    });
}